package com.bitoon.basketdudes.jpa;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

@Entity
@Table(name = "ranking", schema = "rankings")
@NamedQueries({
    @NamedQuery(name = "Ranking.findByRangoPosicion",query = "select p from Ranking p where p.posicion>=:min_pos and p.posicion<=:max_pos order by p.posicion desc"),
    @NamedQuery(name = "Ranking.findByPosicion",     query = "SELECT r FROM Ranking r WHERE r.posicion = :posicion"),
    @NamedQuery(name = "Ranking.findById",           query = "SELECT r FROM Ranking r WHERE r.id = :id")
/*    @NamedQuery(name = "Ranking.findByPosicion", query = "SELECT r FROM Ranking r WHERE r.posicion = :posicion"),
    @NamedQuery(name = "Ranking.findByAntPosicion", query = "SELECT r FROM Ranking r WHERE r.antPosicion = :antPosicion")
     * 
     */
})
public class Ranking implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id = 0;
    @Basic(optional = false)
    @Column(name = "posicion")
    private int posicion = 0;
    @Basic(optional = false)
    @Column(name = "ant_posicion")
    private int antPosicion = 0;

    public Ranking() {
    }

    public Ranking(Integer id) {
        this.id = id;
    }

    public Ranking(Integer id, int posicion, int antPosicion) {
        this.id = id;
        this.posicion = posicion;
        this.antPosicion = antPosicion;
    }

    public int getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public int getPosicion() {
        return posicion;
    }

    public void setPosicion(int posicion) {
        this.posicion = posicion;
    }

    public int getAntPosicion() {
        return antPosicion;
    }

    public void setAntPosicion(int antPosicion) {
        this.antPosicion = antPosicion;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Ranking)) {
            return false;
        }
        Ranking other = (Ranking) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.bitoon.basketdudes.jpa.Ranking[id=" + id + "]";
    }

}
